
<?php if(count($data)){
	foreach($data as $k=>$v){
?>
<fieldset>
    <legend><?php echo $v['Config']['key'];?></legend>
<center><div id="message" >&nbsp;</div><center>
<?php if($this->Session->read('message')){
	echo '<script>showMessage("mainContent","'.$this->Session->read('message').'");</script>';
	$this->Session->delete('message');	
	}?>
<?php if($this->Session->read('error')){
	echo '<script>showMessage("mainContent","'.$this->Session->read('error').'",1);</script>';
	$this->Session->delete('error');
}?>
    
    <form id="adminForm<?php echo $k?>" name="adminForm<?php echo $k?>" method="post" action="<?php echo $this->params['controller']?>/config">
	<table border="0" class="form" style="width:100%">
       	 <?php if(count($v['Children'])){					
					foreach($v['Children'] as $k2=>$v2){						
		?>
          <tr>
            <td class="label" align="right" width="40%"><?php _resource($v2['description'])?> :
            </td>
            <td align="left" width="50%">
            	<?php if($v2['Config']['type']=="text"){ ?>
            		<textarea rows="10" style="width:100%" id="<?php echo $v2['key']?>" name="data[Config][<?php echo $v2['key']?>]"><?php echo $v2['value']?></textarea>
            	<?php }else{ ?>
            		<input class="input" type="text" id="<?php echo $v2['key']?>" name="data[Config][<?php echo $v2['key']?>]" value="<?php echo $v2['value']?>" style="width:100%" maxlength="255" />
            	<?php }?>
            </td>
          </tr>
          <?php }
						
			}
			else{
				echo '<tr><td colspan="20" align="center" style="font-weight:bold;color:red">Không có mẫu tin</td></tr>';
			}
			?>      
        
	</table>
    <div style="width:130px">
          <div class="button"><a onclick="submitForm('adminForm<?php echo $k?>','mainContent');document.getElementById('top').focus();" href="javascript:;" title="<?php echo _resource('save') ?>"  > <span class="icon-32-save"> </span></a> </div>         
          <div class="button"><a onclick="resetForm('adminForm<?php echo $k?>')" href="javascript:;" title="<?php echo _resource('reset') ?>"  > <span class="icon-32-back"> </span></a> </div>          
    </div>
      </form>
</fieldset>
<?php }}?>

<script>
	setTimeout("removeMessage()",8000);	
</script>

